﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Xml.Linq;

namespace AutoCadConvert
{
    class HotSpot:BspObject
    {
        public int m_AreaRef = -1;
        public Point m_Pt = new Point();
        public override IEnumerable<XElement> ToXml()
        {
            return base.ToXml().Concat(new XElement[] {
                new XElement("Area",m_AreaRef),
                new XElement("Pos",m_Pt.ToMirror().To3DString()),
            });
        }
    }
    class HotSpots:Collection
    {
        List<HotSpot> m_HotSpot = new List<HotSpot>();
        public HotSpots(House house):base(house)
        {
        }
        public override void AjustLineAndPoint()
        {
            List<Area> area = m_house.Item<Areas>().m_Areas;
            foreach(Area it in area)
            {
                m_HotSpot.Add(new HotSpot() { m_AreaRef=area.IndexOf(it),m_Pt = it.Center});
            }
        }
        public override IEnumerable<XElement> ToXml()
        {
            int idx = 0;
            foreach (HotSpot hs in m_HotSpot)
                yield return new XElement("_" + idx++, hs.ToXml());
        }
    }
}
